<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head> 
        <title>Facelet Title</title>
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
    </h:head>
    <h:body>
        <h:form id="form">  
    <h:outputLink id="loginLink" value="javascript:void(0)" onclick="PF('dlg').show()" title="login"  >   
       
        <img src="/Park-uniminuto/faces/resources/ima/login.png" id="ima"  />
    </h:outputLink>  
  
    <p:growl id="growl" showDetail="true" life="3000" />  
  
    <p:dialog id="dialog" header="Login" widgetVar="dlg" resizable="false">  
  
        <h:panelGrid columns="2" cellpadding="5">  
            <h:outputLabel  value="Username:" />  
            <p:inputText value="#{login.user.correo}"   
                         id="username" widgetVar="correo"  />  
              
            <h:outputLabel  value="Password:" />  
            <h:inputSecret value="#{login.user.contraseña}"   
                    id="password"   />  
              
            <f:facet name="footer">  
                <p:commandButton id="loginButton" value="Login" update="growl"   
                                 actionListener="#{login.login}"   
                                 oncomplete="handleLoginRequest(xhr, status, args);loginLink.hide();"  > 
                 
                </p:commandButton> 
            </f:facet>  
             <p:commandButton id="logout" value="Cerrar session" update="growl"   
                              actionListener="#{login.logout}"
                              
                    />  
            
        </h:panelGrid>  
          
    </p:dialog>  
</h:form>  
  
<script type="text/javascript">  
    function handleLoginRequest(xhr, status, args) {  
        if(args.validationFailed || !args.loggedIn) {  
            PF('dlg').jq.effect("shake", { times:5 }, 100);  
            
        }   
        else {  
            PF('dlg').hide();  
            
             $('#ima').hide('slow', function() {
    alert('Se Ha logueado Exitosamente.');
  });  
           
        }  
    }  
</script>  
    </h:body>
    
</html>

